//
//  CommodityDetailCollectionViewCell.swift
//  OnceNectar
//
//  Created by 法正磊 on 2018/2/9.
//  Copyright © 2018年 com.inwhoop. All rights reserved.
//

import UIKit

class CommodityDetailCollectionViewCell: UICollectionViewCell, BottomShadow, AddCornerUIRectCorner {
    @IBOutlet weak var mainView: UIView!
    
    @IBOutlet weak var bottomView: UIView!
    @IBOutlet weak var topView: UIView!
    @IBOutlet weak var commodityImageView: UIImageView!
    @IBOutlet weak var specificationIntroductionTextView: UITextView!
    override func awakeFromNib() {
        super.awakeFromNib()
        self.layoutIfNeeded()
        mainView.layoutIfNeeded()
        setShadow(view: self, opacity: bottomShadowOpacity, size: CGSize(width: 0, height: 2), color: UIColor.black, cornerradius: CORNERRADIUS)
        addCornerWithView(aView: mainView, aCorners: .allCorners, aSize: CGSize(width: CORNERRADIUS, height: CORNERRADIUS))
        // Initialization code
    }
    
    func showData(imageURL: String, specification: String) {
        let path:String = "\(BaseURL)\(imageURL)"
        
        let url = NSURL.init(string: path.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!)
        commodityImageView.sd_setImage(with: url! as URL, completed: nil)
        
        specificationIntroductionTextView.text = specification
    }
    
}
